<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="/resources/css/css.css" rel="stylesheet" type="text/css" />
	<script src="/resources/common/js/jquery-1.11.3.min.js"></script>
	<script src="/resources/js/self.js"></script>
	<script type="text/javascript" src="/resources/common/js/md5.js"></script>
	<style type="text/css">
		input::-webkit-input-placeholder{
			color:#fff;
		}
		input::-moz-placeholder{   /* Mozilla Firefox 19+ */
			color:#fff;
		}
		input:-moz-placeholder{    /* Mozilla Firefox 4 to 18 */
			color:#fff;
		}
		input:-ms-input-placeholder{  /* Internet Explorer 10-11 */
			color:#fff;
		}
	</style>
</head>

<body>
<div class="zcbg" style="padding-top: 100px">
<div class="zcmain">
  <div class="zctitle"><img src="/resources/images/zclogo.png" /></div>
  <div class="zcbody">
    <div class="zcxx">
	 <ul>

	  <li>
		  <p>用户名</p>
		  <Span>
			  <input name="account" class="dlname register" type="text" placeholder="请输入用户名"
					 foundfield="" compareway="2">
		  </Span>
	  </li>
	  

		 <li><p>企业类型</p><Span>
		 <select name="userType" class="yzmc register">
      <option value="company">生产企业</option>
      <option value="trans">运输企业</option>
      <option value="buy">采购企业</option>
    </select>
		 </Span></li>
		 
		   
	    <li><p>设置密码</p>
			<Span>
			<input name="password" class="dlname register" type="password" placeholder="输入设置的密码"
				   foundfield="" compareway="2">
			</Span>
		</li>
		
		   
	    <li><p>确认密码</p>
			<Span><input name="password2" class="dlname register" type="password" placeholder="请再次输入密码"
						 foundfield="" compareway="2"></Span>
		</li>
	 </ul>
	 

	<div class="clear"></div>
	</div>
    <button class="zcbut" style="margin-bottom: 30px !important;" onclick="register()">注册</button>
	  <div class="dlqzc">如果您已经有账号可以直接<a href="denglu.html">登录</a></div>
	  <div class="clear"></div>
	<div class="clear"></div>
  </div>
</div>
</div>
<script type="application/javascript">
	function register() {
        var params = getPageDataByClass("register");
        if (strIsNull(params['account'])) {
            alert("请输入账号！");
            return;
        }
        if (strIsNull(params['password'])) {
            alert("请输入密码！");
            return;
        }
        if(params['password'] !=params['password2']){
            alert("密码不一致！");
            return;
		}
        params['password'] = hex_md5((params['password']));
		$(".zcbut").attr("disabled", true);
        $.ajax({
            url: "/front/company/register.do",
            data: params,
            dataType: 'json',
            type: 'post',
            success: function (data) {
                $(".zcbut").removeAttr("disabled");
                if (data.success) {
                    alert("注册成功");
                    var userType = params["userType"];
                    window.location.href = getInitUrl(userType);
                } else {
                    alert(data.msg);
					$(".zcbut").removeAttr("disabled");
                }
            }
        });
    }
    function getInitUrl(userTye) {
        var url ="/html/"+userTye+"/zhuce_1.html?r="+new Date().getTime();
        return url;
    }
</script>
</body>
</html>
